<?php
$f = $_SERVER['REQUEST_METHOD'];
$a = $_GET['a'];
$b = $_GET['b'];

switch($a)
{
    case 'login':
        switch($b)
        {
            case 'index':
            {
                switch($f)
                {
                    case 'GET':
                        require_once('./login.html');
                        break;
                    case 'POST':
                        $username = $_POST['username'];
                        $password = $_POST['password'];

                        if ($username == '123' and $password == '456')
                        {
                            echo '<script LANGUAGE="javascript">alert ("登陆成功")</script>';
                        }
                        else
                        {
                            echo '<script LANGUAGE="javascript">alert ("登陆失败: 用户名或密码错误");window.location.href = "login.html";</script>';
                        }
                        break;
                    default:
                        break;
                }
            }
            break;
        default:
            break;
        }
        break;
    default:
        break;
}
?>